<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<% String path=request.getContextPath(); String basePath=request.getScheme()+ "://" + request.getServerName() + ":" + request.getServerPort() + path+ "/"; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<html  xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="<%=basePath%>">
    <title>对账异常保单查询</title>
    <%@ include file="/WEB-INF/jsp/common/common.jsp" %>
    <script src="<%=path%>/js/jquery.divbox.js" type="text/javascript"></script>
    <script src="js/json2.js" type="text/javascript"></script>
    <script type="text/javascript">

        var effecttime="${effecttime}";
        var failPremium="${failPremium}";
        var count;

        $(document).ready(function() {
            //确认单信息置灰
            $("#effecttime").attr("disabled",true);
            $("#effecttime").css("background-color","#CCC");
            $("#effecttime").val("${effecttime}");
            $("#count").attr("disabled",true);
            $("#count").css("background-color","#CCC");
            $("#count").val("${count}");
            $("#failPremium").attr("disabled",true);
            $("#failPremium").css("background-color","#CCC");
            $("#failPremium").val("${failPremium}");

            queryPolicyPageByEffecttime(1)
        });

        function queryPolicyPageByEffecttime(pageIndex) {

            if(pageIndex == null){
                pageIndex = 1;
            }

            var downloadFlag = false;
            if(pageIndex == -1){
                pageIndex = 1;
                downloadFlag = true;
            }

            $.openLoading();
            $.ajax({
                url: "<%=path%>/ctrip/queryPolicyPageByEffecttime",
                dataType: 'json',
                type: 'POST',
                async: true,
                data: {
                    current: pageIndex,
                    size: 10,
                    effecttime: effecttime
                },
                success:function (page) {
                    $.closeLoading();
                    if($.validate(page)){
                        return;
                    }
                    // $("#count").val(page.total);

                    var tableContent = creatTable("MERCHANTNO@TDH,PRODUCTCODE,BRANCHCODE@TDH,POLICYNO,INSURANCETYPE,PREMIUM,INSUREDNAME,INSUREDCARDNO,EFFECTTIME,EXPIRYTIME,TRANSTIME,COMMISSION",page);

                    var tableObj = $("#policyTable");
                    tableObj.find("tbody").remove();
                    tableObj.append(tableContent);
                    var strPage = creatChannelPage(pageIndex,6,page.maxPage,"114");
                    var pageDIV = $("#policyPageDiv");
                    pageDIV[0].innerHTML="";
                    pageDIV.append(strPage);

                    if(downloadFlag){
                        if(page.data.length == 0){
                            $.message("error", "导出数据为空");
                            return;
                        }
                        $("#queryPolicyListForm").attr("action","<%=path%>/ctrip/downloadExcel/" + effecttime);
                        $("#queryPolicyListForm").submit();
                    }
                }
            });
        }

        function downloadExcel() {
            queryPolicyPageByEffecttime(-1)
        }

    </script>
</head>
<body>
    <div class="current">
        <table class="current_table_1">
            <tbody>
            <tr class="f2">
                <td>
                    <img src="./images/current_1.jpg">
                </td>
                <td class="current_table_1_td">
                    <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                    <span style=" color:#136bab; ">携程旅游
                            <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>对账异常保单/批单查询
                        </span>
                </td>
                <td><img src="./images/current_3.jpg"></td>
            </tr>
            </tbody>
        </table>
    </div>

    <%--查询条件及结果表单--%>
    <table border="1" class="table_02" style="height:150px">
        <tr height="50px">
            <td colspan="2" align="center">
                <form method="post" id="queryPolicyListForm">
                    <table border="0" style="margin: 12px auto;">
                        <tr>
                            <td style="padding-left:40px; border: 0;text-align: right" nowrap="nowrap">交易日期：</td>
                            <td style="border: 0;text-align: left;padding-right: 70px">
                                <input name="effecttime" id="effecttime" class="input_text" style="width:130px;"/>
                            </td>

<%--                            <td style="padding-left:40px;border: 0;text-align: right" nowrap="nowrap">对账异常保单数量：</td>
                            <td style="border: 0;text-align: left;padding-right: 70px">
                                <input name="count" id="count" class="input_text" style="width:130px;"/>
                            </td>

                            <td style="border: 0;text-align: right;" nowrap="nowrap">对账异常保单总保费(元)：</td>
                            <td style="border: 0;text-align: left;padding-right: 70px">
                                <input name="failPremium" id="failPremium" class="input_text" style="width:130px;"/>
                            </td>--%>
                        </tr>
                    </table>
                </form>
            </td>
        </tr>
        <tr>
            <td valign="top">
                <div id="policyDiv" style="width:98%;margin:5px" >
                    <div align="left" style="margin:15px">
                        <input type="button"  class="input_button_2"  value="导出Excel" onClick="downloadExcel()"/>&nbsp;
                    </div>
                    <table class="table_02" id="policyTable">
                        <thead>
                        <tr>
                            <th style="width:7%" nowrap="nowrap">产品代码</th>
                            <th style="width:10%" nowrap="nowrap">单号</th>
                            <th style="width:5%" nowrap="nowrap">状态</th>
                            <th style="width:5%" nowrap="nowrap">保费</th>
                            <th style="width:5%" nowrap="nowrap">被保人姓名</th>
                            <th style="width:10%" nowrap="nowrap">被保人证件号码</th>
                            <th style="width:7%" nowrap="nowrap">生效时间</th>
                            <th style="width:7%" nowrap="nowrap">失效时间</th>
                            <th style="width:7%" nowrap="nowrap">交易时间</th>
                            <th style="width:5%" nowrap="nowrap">佣金</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                    <%--分页--%>
                    <div id="policyPageDiv"  class="page"></div>
                </div>
            </td>
        </tr>
    </table>

</body>
</html>
